import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
let store = new Vuex.Store({
  state: {
    hash: '',
    list: [],
    nameList: []
  },
  getters: {
    show (state) {
      return state.num + 1
    }
  },
  mutations: {
    change (state, arg) {
      state.hash = arg
    },
    add (state, arg) {
      if (state.list.indexOf(arg) === -1) {
        state.list.push(arg)
      }
    },
    addName (state, arg) {
      if (state.nameList.indexOf(arg) === -1) {
        state.nameList.push(arg)
      }
    }
  }
})
export default store
